<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN">
<html>
<head>
	<title>Login</title>
		<meta charset="utf-8">
		<link href="css/style.css" rel='stylesheet' type='text/css' />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
</head>
<body>
	 <!-----start-main---->
	 <div class="main">
		<div class="login-form">
			<h1>Exam system</h1>
					<div class="head">
						<img src="images/user.png" alt=""/>
					</div>
				<form>
						<span class="userType">用户名：</span><input type="text" id="userCode" value="userCode" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'userCode';}" >
						<span class="userType">用户密码：</span><input type="password" id="passWord" value="passWord" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'passWord';}">
					           <span class="userType">学生：</span> <input
							type="radio" id="userName" name="UserName" value="studentName" checked ="true">
						<span class="userType">教师：</span><input type="radio" id="userName" name="UserName"
							value="teacherName"><br /> 
						<div class="submit">
							<input type="button" class="input" onclick="input()" value="LOGIN" >
					</div>	
					<p><a href="#">Forgot Password ?</a></p>
					<input type="button"
							class="register" value="Teacher Register" onclick="register()" />
				</form>
			</div>
			<!--//End-login-form-->
			 <!-----start-copyright---->
   					<div class="copy-right">
						<p>Copyright &copy; 2014.Company name All rights reserved.<a target="_blank" href="http://sc.chinaz.com/moban/">&#x7F51;&#x9875;&#x6A21;&#x677F;</a></p> 
					</div>
				<!-----//end-copyright---->
		</div>
			 <!-----//end-main---->
		 		
<div style="display:none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
<script src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
	function input() {
			var data = {
				userCode : $("#userCode").val(),
				passWord : $("#passWord").val(),
				userName : $("input[name='UserName']:checked").val()
			};
			$.get("validation.do", data, function(back) {
				if (back == "1") {
					alert("登录成功");
					window.location.href = 'studentMain.do';
				} else if (back == "3") {
					alert("登录成功");
					window.location.href = 'teacherMain.do';
				} else {
					alert("用户名或密码错误!");
				}
			})
	}
	
	function register(){
			window.location.href = 'register.do';
	}
</script>

</html>